import request from '@/utils/request.js'

// 选课操作
export function saveLesson(data) {
  return request({
    url: '/selectlesson/create',
    method: 'post',
    data
  })
}

// 退课操作
export function removeLesson(data) {
  return request({
    url: '/selectlesson/remove',
    method: 'post',
    data
  })
}

// 根据课程名称，教师名称进行模糊查询
export function searchLessonByKey(data) {
  return request({
    url: '/selectlesson/search/key',
    method: 'post',
    data: {
      [data.label]: data.value,
      page_num: data.page_num,
      page_size: data.page_size,
      stu_num: data.stu_num
    }
  })
}

// 【教师-我的学生】根据教师id和学生姓名模糊查询
export function searchStudentByTidAndStuName(data) {
  return request({
    url: '/selectlesson/search/mystu',
    method: 'post',
    data: {
      [data.label]: data.value,
      tid: data.tid,
      page_size: data.page_size,
      page_num: data.page_num
    }
  })
}

// 查询学生选择某一教师的所有课程，根据学生学号和教师id查询
export function findAllTeacherCourseWithStu(stu, tid) {
  return request({
    url: `/selectlesson/search/stuCourse?stu=${stu}&tid=${tid}`
  })
}
